package com.medical.admin.cost.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.medical.admin.cost.common.dto.OutpatientInfo;
import com.medical.admin.cost.entity.Indent;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface IndentMapper extends BaseMapper<Indent> {
    List<OutpatientInfo> selectPageList(@Param("outpatientInfo") OutpatientInfo outpatientInfo);

    default int updateByIndentId(Indent indent) {
        QueryWrapper<Indent> qw = new QueryWrapper<>();
        qw.lambda().eq(Indent::getIndentId, indent.getIndentId());
        return this.update(indent,qw);
    }

    default Indent selectByPatenetId(Long patientId) {
        QueryWrapper<Indent> qw = new QueryWrapper<>();
        qw.lambda().eq(Indent::getPatientId, patientId);
        return this.selectOne(qw);
    }

    default Integer updateByPatientId(Indent indent) {
        QueryWrapper<Indent> qw = new QueryWrapper<>();
        qw.lambda().eq(Indent::getPatientId, indent.getPatientId());
        return this.update(indent,qw);
    }

    default Integer deleteByPatientId(Long patient) {
        QueryWrapper<Indent> qw = new QueryWrapper<>();
        qw.lambda().eq(Indent::getPatientId, patient);
        return this.delete(qw);
    }
}